/*
 * Project: yygh-parent
 *
 * File Created at 2023/7/11
 *
 * 自定义时间格式代替DATE标签：2023-07-11 17:21:17:21
 */
package com.atguigu.yygh.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.atguigu.yygh.model.cmn.Dict;
import com.atguigu.yygh.model.cmn.DictEeVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @author 用户名
 * @Type DictListener.java
 * @Desc
 * @date 2023/7/11 17:21
 */
public class DictListener extends AnalysisEventListener<DictEeVo> {
    BaseMapper baseMapper;
    public DictListener(BaseMapper baseMapper){
        this.baseMapper=baseMapper;
    }
    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
        if(baseMapper==null){
            return;
        }
        
        if(dictEeVo!=null){
            Dict dict = new Dict();

            BeanUtils.copyProperties(dictEeVo,dict);
            dict.setIsDeleted(0);
            dict.setUpdateTime(new Date());
            baseMapper.insert(dict);
        }


    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}


/**
 * Revision history
 * -------------------------------------------------------------------------
 * <p>
 * Date Author Note
 * -------------------------------------------------------------------------
 * 2023/7/11 用户名 create
 */ 
